using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace VotingSystem.Models
{
    public class SurveyResponse
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public int SurveyId { get; set; }

        public string? RespondentId { get; set; }

        [Required]
        public DateTime SubmitTime { get; set; }

        public string? IPAddress { get; set; }

        [ForeignKey("SurveyId")]
        public Survey? Survey { get; set; }

        [ForeignKey("RespondentId")]
        public ApplicationUser? Respondent { get; set; }

        public virtual ICollection<QuestionResponse> QuestionResponses { get; set; } = new List<QuestionResponse>();

        public SurveyResponse()
        {
            QuestionResponses = new List<QuestionResponse>();
            SubmitTime = DateTime.Now;
        }
    }
} 